package com.t.bricks.bussiness.db.mapper.flowwork;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.t.bricks.bussiness.db.entity.flowwork.FlowDefine;
import com.t.bricks.bussiness.db.entity.flowwork.FlowWork;

@Mapper
public interface FlowWorkMapper {
	
	/**
	 * 添加
	 * @Param flowWork
	 * @return int
	 */
	int addWork(FlowWork flowWork);

	/**
	 * 修改状态
	 * @param uId 记录编号
	 * @param iState 新的状态
	 * @param iVersion 当前版本号
	 * @param sMemo 备注信息(null则不更新)
	 * @return
	 */
	int changeState(
		@Param("uId") String uId,
		@Param("iState") Integer iState,
		@Param("iVersion") Integer iVersion,
		@Param("sMemo") String sMemo
	);

	/**
	 * 修改状态(由节点引发)
	 * @param uId 记录编号
	 * @param iState 新的状态
	 * @return
	 */
	int changeStateByNode(
		@Param("uId") String uId,
		@Param("iState") Integer iState
	);
	
	/**
	 * 根据流程定义标识查询数据
	 * @Param sSign
	 * @return FlowDefine
	 */
	FlowDefine findBysSign(@Param("sSign") String sSign);
	
}
